#ifndef AUTHROLEDLG_H
#define AUTHROLEDLG_H

#include "api/systemManager/UserManagerApi.h"
#include <QDialog>
#include <QList>

namespace Ui {
class AuthRoleDlg;
}

class AuthRoleDlg : public QDialog
{
    Q_OBJECT

public:
    AuthRoleDlg(const AuthRoleDlg &) = delete;
    AuthRoleDlg(AuthRoleDlg &&) = delete;
    AuthRoleDlg &operator=(const AuthRoleDlg &) = delete;
    AuthRoleDlg &operator=(AuthRoleDlg &&) = delete;
    explicit AuthRoleDlg(int userId, QWidget *parent = nullptr);
    ~AuthRoleDlg();

private slots:

    void on_comboBox_currentIndexChanged(int index);

    void on_lineEdit_gotoPage_returnPressed();

    void on_toolButton_clicked();

    void on_btn_nextPage_clicked();

    void on_btn_close_clicked();

    void on_btn_submit_clicked();

private:
    Ui::AuthRoleDlg *ui;

    QString userId;
    UserManagerApi userManagerApi;
    QList<Role> roles;
    User *user;
    Utils utils;
    QStringList tableColumn;
    QString userRoleIds;
    QStringList roleIds;
    //每页大小
    int pageSize = 10;
    int count;
    int currentPage = 1;

    void setTableWidget();
    void init();
    void getUserAndRoles();
};

#endif // AUTHROLEDLG_H
